package com.info.zhiduoduo.pay.controller;

import com.info.zhiduoduo.common.constants.SmartResult;
import com.info.zhiduoduo.pay.formbean.zhaoshangtradebulter.CreateSubLedgerFormBean;
import com.info.zhiduoduo.pay.formbean.zhaoshangtradebulter.DeleteSubLedgerFormBean;
import com.info.zhiduoduo.pay.formbean.zhaoshangtradebulter.QuerySubLedgerBalanceFormBean;
import com.info.zhiduoduo.pay.formbean.zhaoshangtradebulter.QuerySubLedgerHistoryTradeFormBean;
import com.info.zhiduoduo.pay.formbean.zhaoshangtradebulter.QuerySubLedgerStatusFormBean;
import com.info.zhiduoduo.pay.formbean.zhaoshangtradebulter.QuerySubLedgerTradeFormBean;
import com.info.zhiduoduo.pay.formbean.zhaoshangtradebulter.SubLedgerPayFormBean;
import com.info.zhiduoduo.pay.sdk.zhaoshangbank.model.request.tradebulter.detail.UpdateSubLedgerInfo;
import com.info.zhiduoduo.pay.service.ZhaoShangTradeBulterService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/zhaoshangTradeBulter")
public class ZhaoShangTradeBulterController {

	@Autowired
	ZhaoShangTradeBulterService zhaoShangTradeBulterService;

	@ApiOperation("新增记账子单元")
	@PostMapping("/createSubLedger")
	public SmartResult createSubLedger(@Valid @RequestBody CreateSubLedgerFormBean formBean) {
		return zhaoShangTradeBulterService.createSubLedger(formBean);
	}

	@ApiOperation("删除记账子单元")
	@PostMapping("/deleteSubLedger")
	public SmartResult deleteSubLedger(@Valid @RequestBody DeleteSubLedgerFormBean formBean) {
		return zhaoShangTradeBulterService.deleteSubLedger(formBean);
	}

	@ApiOperation("修改记账子单元")
	@PostMapping("/updateSubLedger")
	public SmartResult updateSubLedger(@Valid @RequestBody UpdateSubLedgerInfo formBean) {
		return zhaoShangTradeBulterService.updateSubLedger(formBean);
	}

	@ApiOperation("记账子单元余额查询")
	@PostMapping("/querySubLedgerBalance")
	public SmartResult querySubLedgerBalance(@Valid @RequestBody QuerySubLedgerBalanceFormBean formBean) {
		return zhaoShangTradeBulterService.querySubLedgerBalance(formBean);
	}

	@ApiOperation("记账子单元信息状态查询")
	@PostMapping("/querySubLedgerStatus")
	public SmartResult querySubLedgerStatus(@Valid @RequestBody QuerySubLedgerStatusFormBean formBean) {
		return zhaoShangTradeBulterService.querySubLedgerStatus(formBean);
	}

	@ApiOperation("记账子单元内部转账")
	@PostMapping("/subLedgerPay")
	public SmartResult subLedgerPay(@Valid @RequestBody SubLedgerPayFormBean formBean) {
		return zhaoShangTradeBulterService.subLedgerPay(formBean);
	}

	/*@ApiOperation("记账子单元退款经办")
	@PostMapping("/subLedgerRefund")
	public SmartResult subLedgerRefund(@Valid @RequestBody SubLedgerRefundFormBean formBean) {
		return zhaoShangTradeBulterService.subLedgerRefund(formBean);
	}*/

	@ApiOperation("当日交易记录")
	@PostMapping("/querySubLedgerTodayTrade")
	public SmartResult querySubLedgerTodayTrade(@Valid @RequestBody QuerySubLedgerTradeFormBean formBean) {
		return zhaoShangTradeBulterService.querySubLedgerTodayTrade(formBean);
	}

	@ApiOperation("历史交易记录")
	@PostMapping("/querySubLedgerHistoryTrade")
	public SmartResult querySubLedgerHistoryTrade(@Valid @RequestBody QuerySubLedgerHistoryTradeFormBean formBean) {
		return zhaoShangTradeBulterService.querySubLedgerHistoryTrade(formBean);
	}
}
